package com.huangkailong.designpattern.factory.simplefactory;

/**
 * 课程工厂.
 *
 * @author huangkl
 * @since 1.0.0
 */
public class CourseFactory {

    /**
     * 创建课程.
     *
     * @param courseType 课程类型，可选值：java,python
     * @return {@link Course}
     */
    public static Course create(String courseType) {
        switch (courseType) {
            case "java":
                return new JavaCourse();
            case "python":
                return new PythonCourse();
            default:
                throw new IllegalArgumentException("不支持创建" + courseType + "类型的课程对象!");
        }
    }
}
